<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html">
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title></title>
</head>
<body erke-hide>
</body>
<script>
/**
 * @param {number[]} g
 * @param {number[]} s
 * @return {number}
 */
var findContentChildren = function(g, s) {
	g=g.sort(aAronDie);
		s=s.sort(aAronDie);
		console.log(g);
		console.log(s);
    var count=0;
    for(var i=0;i<g.length;i++){
    	var eat=false;
    	for(var j=0;j<s.length;j++){
	    	if(g[i]<=s[j]){
	    		s.splice(j,1);
	    		eat=true;
	    		break;
	    	};
	    	console.log(s);
	    };
    	if(eat){
    		count++
    	}else{
    		break;
    	};
    };
    console.log(count);
    return count;
};
function aAronDie(a,b){
	return a-b;
}
var res=new findContentChildren([10,9,8,7],[5,6,7,8]);
</script>
</html>